package com.ruoyi.web.controller.com;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.domain.OperateBasicForm;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.com.domain.ComBusinessClassify;
import com.ruoyi.com.service.IComBusinessClassifyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 业务管理-分类设置Controller
 *
 * @author sunye
 * @date 2024-12-07
 */
@RestController
@RequestMapping("/com/comBusinessClassify")
@Api(tags = "业务管理-分类设置")
public class ComBusinessClassifyController extends BaseController
{
    @Autowired
    private IComBusinessClassifyService comBusinessClassifyService;

    /**
     * 查询业务管理-分类设置列表
     */
    @ApiOperation(value = "查询业务管理-分类设置列表")
    @GetMapping("/list")
    public TableDataInfo list(ComBusinessClassify comBusinessClassify)
    {
        startPage();
        comBusinessClassify.setDeptId(getDeptId());
        comBusinessClassify.setSmallId(getSmallId());
        List<ComBusinessClassify> list = comBusinessClassifyService.selectComBusinessClassifyList(comBusinessClassify);
        return getDataTable(list);
    }


    /**
     * 查询业务管理-分类设置所有列表
     */
    @ApiOperation(value = "查询业务管理-分类设置所有列表")
    @GetMapping("/allList")
    public AjaxResult allList(ComBusinessClassify comBusinessClassify)
    {
        startPage();
        comBusinessClassify.setDeptId(getDeptId());
        comBusinessClassify.setSmallId(getSmallId());
        List<ComBusinessClassify> list = comBusinessClassifyService.selectComBusinessClassifyList(comBusinessClassify);
        return success(list);
    }


    /**
     * 获取业务管理-分类设置详细信息
     *
     *
     */
    @ApiOperation(value = "获取业务管理-分类设置详细信息")
    @GetMapping(value = "/{classifyId}")
    public AjaxResult getInfo(@PathVariable("classifyId") Long classifyId)
    {
        return success(comBusinessClassifyService.selectComBusinessClassifyByClassifyId(classifyId));
    }

    /**
     * 新增业务管理-分类设置
     */
    @ApiOperation(value = "新增业务管理-分类设置")
    @Log(title = "业务管理-分类设置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ComBusinessClassify comBusinessClassify)
    {
        comBusinessClassify.setCreateId(getUserId());
        comBusinessClassify.setDeptId(getDeptId());
        comBusinessClassify.setSmallId(getSmallId());
        return toAjax(comBusinessClassifyService.insertComBusinessClassify(comBusinessClassify));
    }

    /**
     * 修改业务管理-分类设置排序
     */
    @ApiOperation(value = "修改业务管理-分类设置排序")
    @Log(title = "修改业务管理-分类设置排序", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ComBusinessClassify comBusinessClassify)
    {
        comBusinessClassify.setUpdateId(getUserId());
        return toAjax(comBusinessClassifyService.updateComBusinessClassify(comBusinessClassify));
    }
    /**
     * 删除业务管理-分类设置
     */
    @ApiOperation(value = "删除业务管理-分类设置")
    @Log(title = "业务管理-分类设置", businessType = BusinessType.DELETE)
    @DeleteMapping("/{classifyId}")
    public AjaxResult remove(@PathVariable Long classifyId)
    {
        return toAjax(comBusinessClassifyService.deleteComBusinessClassifyByClassifyId(classifyId));
    }
//
//
//    /**
//     * 置为有效/无效业务管理-分类设置
//     */
//    @Log(title = "置为无效业务管理-分类设置", businessType = BusinessType.UPDATE)
//    @PostMapping("effectiveStatus")
//    public AjaxResult effectiveStatus(@RequestBody OperateBasicForm operateBasicForm)
//    {
//        return toAjax(comBusinessClassifyService.effectiveStatus(operateBasicForm));
//    }
}
